package model;

import entity.ChessUser;

import java.io.Serializable;

/**
 * 房间信息,因为在报文中使用,进行序列化.
 *
 * @author 张天羿
 */
public class RoomInfo implements Serializable {
    public static final int NONE = 0;//房间无人
    public static final int WAIT = 1;//一人在等待
    public static final int PLAYING = 2;//游戏进行
    private int rid;//房间编号
    private ChessUser leftPlayer;//房间内左边玩家
    private ChessUser rightPlayer;//房间内右边玩家
    private int status;//房间的状态
    private boolean isLeftReady = false;//左边玩家是否准备
    private boolean isRightReady = false;//右边玩家是否准备
    private boolean isLeftPlay = false;//左边玩家是否可落子
    private boolean isRightPlay = false;//右边玩家是否可落子

    public boolean isLeftReady() {
        return isLeftReady;
    }

    public void setLeftReady(boolean isLeftReady) {
        this.isLeftReady = isLeftReady;
    }

    public boolean isRightReady() {
        return isRightReady;
    }

    public void setRightReady(boolean isRightReady) {
        this.isRightReady = isRightReady;
    }

    public int getRid() {
        return rid;
    }

    public ChessUser getLeftPlayer() {
        return leftPlayer;
    }

    public void setLeftPlayer(ChessUser leftPlayer) {
        this.leftPlayer = leftPlayer;
    }

    public ChessUser getRightPlayer() {
        return rightPlayer;
    }

    public void setRightPlayer(ChessUser rightPlayer) {
        this.rightPlayer = rightPlayer;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public RoomInfo(int rid, ChessUser leftPlayer, ChessUser rightPlayer, int status) {
        super();
        this.rid = rid;
        this.leftPlayer = leftPlayer;
        this.rightPlayer = rightPlayer;
        this.status = status;
    }

    public String toString() {
        return "房间号: " + rid + "状态: " + status + ", 左边玩家: " + leftPlayer + ",是否准备" + isLeftReady() + ", 右边玩家: " + rightPlayer;
    }

}


